from django.db import models

# Create your models here.

class Author(models.Model):
    name=models.CharField(max_length=10,verbose_name='作者')
    class Meta:
        db_table='author'
        verbose_name_plural='作者表'
    def __str__(self):
        return self.name

class Book(models.Model):
    book_name=models.CharField(max_length=20,verbose_name='书籍名称')
    img=models.CharField(max_length=200,verbose_name='书籍封面')
    author=models.ForeignKey(Author,on_delete=models.CASCADE,verbose_name='书籍作者')
    class Meta:
        db_table='book'
        verbose_name_plural='书籍表'
    def __str__(self):
        return self.book_name